package IC.Parser;

@SuppressWarnings("serial")
public class SyntaxError extends Exception {
	SyntaxError(String filename,int line, String id, Object value) {
		this.line = line;
		this.filename = filename;
		this.stringId = id;
		this.msg = null;
		if (value == null)
			return;
		
		this.value = value.toString();
	}
	SyntaxError(String filename,int line, String msg) {
		this.msg = msg;
		this.filename = filename;
	}
	public String toString() {
		if (msg == null)
			return ("Syntax Error: "+filename+ " line: " +line+ " [parse error at "+stringId+" "+(value != null ? "'"+value+"'" : "" )+"]");
		else
			return ("Syntax Error: "+filename+" line: "+line+" : "+msg);
	}
	private int line;
	private String stringId;
	private String value;
	private String msg;
	private String filename;
}
